package com.mes.cloud.web;

import com.mes.cloud.api.dto.request.role.BatchDeletePositionTypeRequest;
import com.mes.cloud.api.dto.request.role.BindPositionTypeRequest;
import com.mes.cloud.api.dto.request.role.PositionTypePageListRequest;
import com.mes.cloud.api.dto.response.role.RolePositionTypeDto;
import com.mes.cloud.common.CommPager;
import com.mes.cloud.common.JsonResult;
import com.mes.cloud.service.SysPositionTypeRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author wxm
 * @version 2019-08-03 14:47:34
 * @email xiaomin.wu1@pactera.com
 */
@Api(tags = "角色岗位类型关联表", value = "角色岗位类型关联表接口")
@RestController
@RequestMapping(value = "/sysPositionTypeRole")
public class SysPositionTypeRoleController  {

    private SysPositionTypeRoleService sysPositionTypeRoleService;

    @Autowired
    public SysPositionTypeRoleController(SysPositionTypeRoleService sysPositionTypeRoleService) {
        this.sysPositionTypeRoleService = sysPositionTypeRoleService;
    }


    /**
     * 查看岗位类型
     *
     * @param positionTypePageListRequest
     * @return
     */
    @ApiOperation(value = "查看岗位类型", notes = "查看岗位类型")
    @PostMapping(value = "/positionTypePageList")
    public JsonResult<CommPager<RolePositionTypeDto>> positionTypePageList(@Valid @RequestBody PositionTypePageListRequest positionTypePageListRequest) {
        return sysPositionTypeRoleService.positionTypePageList(positionTypePageListRequest);
    }

    /**
     * 增加岗位类型
     *
     * @param bindPositionTypeRequest
     * @return
     */
    @ApiOperation(value = "增加岗位类型", notes = "增加岗位类型")
    @PostMapping(value = "/bindPositionType")
    public JsonResult bindPositionType(@Valid @RequestBody BindPositionTypeRequest bindPositionTypeRequest) {
        return sysPositionTypeRoleService.bindPositionType(bindPositionTypeRequest);
    }

    /**
     * 批量删除
     *
     * @param batchDeletePositionTypeRequest
     * @return
     */
    @ApiOperation(value = "批量删除", notes = "批量删除")
    @PostMapping(value = "/batchDelete")
    public JsonResult batchDelete(@Valid @RequestBody BatchDeletePositionTypeRequest batchDeletePositionTypeRequest) {
        return sysPositionTypeRoleService.batchDelete(batchDeletePositionTypeRequest);
    }
}
